<extend name="base"/>
<block name="body">
<script language="javascript">$(document).ready(wechat_obj.reply_keyword_init);</script>
	<div id="reply_keyword" class="r_con_wrap">   
        <form id="keyword_reply_form" class="r_con_form" action="{:U('keywordShow')}" method="post">
            <div class="rows">
                <label>关键词</label>
                <span class="input"><textarea name="keywords" class="keywords" notnull>{$keyword.keywords}</textarea><div class="tips"></div></span>
                <div class="clear"></div>
            </div>
            <div class="rows">
                <label>匹配模式</label>
                <span class="input">
                    <input type="radio" name="matchingtype" value="0" <eq name="keyword.matchingtype" value="1"><else/>checked</eq> />精确匹配<span class="tips">（用户输入的文字和此关键词一样才会触发）</span><br />
                    <input type="radio" name="matchingtype" value="1"  <eq name="keyword.matchingtype" value="1">checked</eq>/>模糊匹配<span class="tips">（只要用户输入的文字包含此关键词就触）</span><br />
                </span>
                <div class="clear"></div>
            </div>
            <div class="rows">
                <label>回复类型</label>
                <span class="input"><select name="ReplyMsgType">
                    <option value="0" <if condition="($keyword.msgtype EQ 'text')">selected</if>>文字消息</option>
                    <option value="1" <if condition="$keyword.msgtype NEQ 'text'">selected</if>>图文消息</option>
                </select></span>
                <div class="clear"></div>
            </div>
            <div class="rows" id="text_msg_row">
                <label>回复内容</label>
                <span class="input"><textarea name="text">{$textmsg.text}</textarea></span>
                <div class="clear"></div>
            </div>
            <div class="rows" id="img_msg_row">
                <label>回复内容</label>
                <span class="input">
                    <select name='MaterialId'>
	                    <option value=''>--请选择--</option>
	                    <optgroup label='---------------系统业务模块---------------'></optgroup>
	                    <foreach name="modules" item="v">
	                          <option value='{$v.name}' <eq name="keyword.msgtype" value="$v.name">selected="selected"</eq>>{$v.title}</option>
	                    </foreach>
	                    <optgroup label='---------------图文消息---------------'></optgroup>
                        <foreach name="newsmsgs" item="v">
                              <option value='{$v.id}' <eq name="keyword.msgid" value="$v.id">selected="selected"</eq>>【<eq name="v.msgtype" value="onenews">单图文<else/>多图文</eq>】{$v.title}</option>
                        </foreach>
                    </select>
                 </span>   
                <div class="clear"></div>
            </div>
            <div class="rows">
                <label></label>
                <span class="input"><input type="submit" class="btn_green" name="submit_button" value="提交保存" /><a href="{:U('Wechat/keyword')}" class="btn_gray">返回</a></span>
                <div class="clear"></div>
            </div>
            <input type="hidden" name="id" value="{$keyword['id']}">
        </form>
    </div>  
</block>